package com.demo.security.sign;

import java.security.PrivateKey;
import java.security.PublicKey;

/**
 * 数字签名：SHA1withRSA
 *
 * @author lee9213@163.com
 * @version 1.0
 * @date 2017/3/17 13:26
 */
public class SHA1withRSASign {

    /**
     * 签名
     * @param content
     * @param privateKey
     * @return
     * @throws Exception
     */
    public static byte[] sign(byte[] content, PrivateKey privateKey) throws Exception {
        return SignUtil.sign(content,privateKey,"SHA1");
    }

    /**
     * 校验
     * @param content
     * @param sign
     * @param publicKey
     * @return
     * @throws Exception
     */
    public static boolean verify(byte[] content, byte[] sign, PublicKey publicKey) throws Exception {
        return SignUtil.validate(content,sign,publicKey,"SHA1");
    }
}
